package com.ruoyi.financial.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bizsys.domain.FinancialManagement;
import com.ruoyi.bizsys.domain.FinancialManagementVo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.financial.service.FinancialManagementService;
import org.apache.commons.collections.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/business/financial")
public class FinancialManagementController extends BaseController {

    @Autowired
    private FinancialManagementService financialManagementService;
    /**
     * 查询财务管理信息
     */
    @Log(title = "财务管理列表", businessType = BusinessType.GET)
    @GetMapping("/list")
    public TableDataInfo list(FinancialManagementVo financialManagementvo){
        startPage();
        return getDataTable(financialManagementService.getlist(financialManagementvo));
    }

    /**
     * 审核
     */
    @PreAuthorize("@ss.hasPermi('system:menu:examine')")
    @Log(title = "财务管理列表", businessType = BusinessType.UPDATE)
    @PostMapping("/examine")
    public AjaxResult update(@RequestBody JSONObject jsonObject){
        financialManagementService.examine(jsonObject);
        return AjaxResult.success();
    }
}
